﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Inspired.Euler.Tests
{
    /// <summary>
    /// Tests for problems from 1 to 9
    /// </summary>
    [TestClass]
    public class Problems001To009
    {
        [TestMethod]
        [Description("Add all the natural numbers below one thousand that are multiples of 3 or 5.")]
        public void Problem001()
        {
            Assert.AreEqual(233168, Euler.Problem001.Solve());
        }

        [TestMethod]
        [Description("Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.")]
        public void Problem002()
        {
            Assert.AreEqual(4613732, Euler.Problem002.Solve());
        }

        [TestMethod]
        [Description("Find the largest prime factor of a composite number.")]
        public void Problem003()
        {
            Assert.AreEqual(6857, Euler.Problem003.Solve());
        }

        [TestMethod]
        [Description("Find the largest palindrome made from the product of two 3-digit numbers.")]
        public void Problem004()
        {
            Assert.AreEqual(906609, Euler.Problem004.Solve());
        }

        [TestMethod]
        [Description("What is the smallest number divisible by each of the numbers 1 to 20?")]
        public void Problem005()
        {
            Assert.AreEqual(232792560, Euler.Problem005.Solve());
        }

        [TestMethod]
        [Description("What is the difference between the sum of the squares and the square of the sums?")]
        public void Problem006()
        {
            Assert.AreEqual(25164150, Euler.Problem006.Solve());
        }

        [TestMethod]
        [Description("Find the 10001<sup>st</sup> prime.")]
        public void Problem007()
        {
            Assert.AreEqual(104743, Euler.Problem007.Solve());
        }

        [TestMethod]
        [Description("Discover the largest product of five consecutive digits in the 1000-digit number.")]
        public void Problem008()
        {
            Assert.AreEqual(40824, Euler.Problem008.Solve());
        }

        [TestMethod]
        [Description("Find the only Pythagorean triplet, {<var>a</var>, <var>b</var>, <var>c</var>}, for which <var>a</var> + <var>b</var> + <var>c</var> = 1000.")]
        public void Problem009()
        {
            Assert.AreEqual(31875000, Euler.Problem009.Solve());
        }
    }
}
